<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>

<script>
spellcheck_test(
    '<div contenteditable><span>[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable><span>[#zz#. ]</span></div>',
    'Typing in child without spellcheck attribute whose parent node does not have spellcheck attribute.');

spellcheck_test(
    '<div contenteditable><span spellcheck="true">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable><span spellcheck="true">[#zz#. ]</span></div>',
    'Typing in child with spellcheck=true whose parent node does not have spellcheck attribute.');

spellcheck_test(
    '<div contenteditable><span spellcheck="false">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable><span spellcheck="false">[zz. ]</span></div>',
    'Typing in child with spellcheck=false whose parent node does not have spellcheck attribute.');

spellcheck_test(
    '<div contenteditable spellcheck="true"><span>[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="true"><span>[#zz#. ]</span></div>',
    'Typing in child without spellcheck attribute whose parent node has spellcheck=true.');

spellcheck_test(
    '<div contenteditable spellcheck="true"><span spellcheck="true">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="true"><span spellcheck="true">[#zz#. ]</span></div>',
    'Typing in child with spellcheck=true whose parent node has spellcheck=true.');

spellcheck_test(
    '<div contenteditable spellcheck="true"><span spellcheck="false">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="true"><span spellcheck="false">[zz. ]</span></div>',
    'Typing in child with spellcheck=false whose parent node has spellcheck=true.');

spellcheck_test(
    '<div contenteditable spellcheck="false"><span>[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="false"><span>[zz. ]</span></div>',
    'Typing in child without spellcheck attribute whose parent node has spellcheck=false.');

spellcheck_test(
    '<div contenteditable spellcheck="false"><span spellcheck="true">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="false"><span spellcheck="true">[#zz#. ]</span></div>',
    'Typing in child with spellcheck=true whose parent node has spellcheck=false.');

spellcheck_test(
    '<div contenteditable spellcheck="false"><span spellcheck="false">[|]</span></div>',
    'insertText zz. ',
    '<div contenteditable spellcheck="false"><span spellcheck="false">[zz. ]</span></div>',
    'Typing in child with spellcheck=false whose parent node has spellcheck=false.');

spellcheck_test(
    '<div contenteditable><span spellcheck="false">zz</span>&nbsp;|</div>',
    'insertText zz. ',
    '<div contenteditable><span spellcheck="false">zz</span>\u00A0#zz#.\u00A0</div>',
    'Typing in spellchecked parent should not check child with spellcheck=false.');
</script>
